home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6182 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  39 lines

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Newbie C question
  5. Date: Thu, 22 Feb 96 23:34:32 GMT
  6. Organization: none
  7. Message-ID: <825032072snz@genesis.demon.co.uk>
  8. References: <Dn4us9.Mu@undergrad.math.uwaterloo.ca>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <Dn4us9.Mu@undergrad.math.uwaterloo.ca>
  15.            sckettle@undergrad.math.uwaterloo.ca "Steve Kettle" writes:
  16.  
  17. >Hi, how the heck does one convert the error codes found in <errno.h> 
  18. >to strings?  I heard about a perror function but can't find it.
  19.  
  20. Any good book on C should document perror() since it is part of the
  21. standard library.
  22.  
  23. #include <stdio.h>
  24.  
  25. void perror(const char *s);
  26.  
  27. s is either a null pointer or a pointer to a string. If s points to
  28. a non-zero length string it is written to stderr followed by the characters
  29. ':' and ' '. An error message corresponding to the value in errno is then
  30. written and finally a newline character. The error message is the same as
  31. that returned by the strerror() (with a suitable argument).
  32.  
  33.  
  34. -- 
  35. -----------------------------------------
  36. Lawrence Kirby | fred@genesis.demon.co.uk
  37. Wilts, England | 70734.126@compuserve.com
  38. -----------------------------------------
  39.